package entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Francis
 */
@Entity
@Table(name = "payment", catalog = "2handeasy", schema = "dbo")
@NamedQueries({@NamedQuery(name = "Payment.findAll", query = "SELECT p FROM Payment p"), @NamedQuery(name = "Payment.findByPaymentID", query = "SELECT p FROM Payment p WHERE p.paymentID = :paymentID"), @NamedQuery(name = "Payment.findByUserID", query = "SELECT p FROM Payment p WHERE p.userID = :userID"), @NamedQuery(name = "Payment.findByHoldername", query = "SELECT p FROM Payment p WHERE p.holdername = :holdername"), @NamedQuery(name = "Payment.findByNumber", query = "SELECT p FROM Payment p WHERE p.number = :number"), @NamedQuery(name = "Payment.findByBank", query = "SELECT p FROM Payment p WHERE p.bank = :bank"), @NamedQuery(name = "Payment.findByCompany", query = "SELECT p FROM Payment p WHERE p.company = :company"), @NamedQuery(name = "Payment.findByIssueDate", query = "SELECT p FROM Payment p WHERE p.issueDate = :issueDate"), @NamedQuery(name = "Payment.findByAmount", query = "SELECT p FROM Payment p WHERE p.amount = :amount"), @NamedQuery(name = "Payment.findByDate", query = "SELECT p FROM Payment p WHERE p.date = :date"), @NamedQuery(name = "Payment.findByTime", query = "SELECT p FROM Payment p WHERE p.time = :time"), @NamedQuery(name = "Payment.findByCurrency", query = "SELECT p FROM Payment p WHERE p.currency = :currency"), @NamedQuery(name = "Payment.findByAddress", query = "SELECT p FROM Payment p WHERE p.address = :address")

/*
 * //person
,@NamedQuery(name="Person.login", query="SELECT p FROM Person p WHERE p.loginname =:loginname AND p.password = :password"),
@NamedQuery(name="Person.updatePassword", query="UPDATE Person p SET p.password = :newPass WHERE p.password = :oldPass AND p.personID = :personID"),
@NamedQuery(name="Person.updateInformation", query="UPDATE Person p SET p.email = :email,  p.address = :address, p.birth_year = :birth_year, p.birth_month = :birth_month WHERE p.personID = :personID")
//book
,@NamedQuery(name = "Book.IncrementClicksByBookID", query = "UPDATE Book SET clicks = clicks+1 WHERE bookID = :bookID")
*/
})
public class Payment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "paymentID", nullable = false)
    private Integer paymentID;
    @Column(name = "userID", length = 50)
    private String userID;
    @Column(name = "holdername", length = 50)
    private String holdername;
    @Column(name = "number", length = 50)
    private String number;
    @Column(name = "bank", length = 50)
    private String bank;
    @Column(name = "company", length = 50)
    private String company;
    @Column(name = "issueDate", length = 50)
    private String issueDate;
    @Column(name = "amount", precision = 19, scale = 4)
    private BigDecimal amount;
    @Column(name = "date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @Column(name = "time")
    @Temporal(TemporalType.TIMESTAMP)
    private Date time;
    @Column(name = "currency", length = 50)
    private String currency;
    @Column(name = "address", length = 50)
    private String address;

    public Payment() {
    }

    public Payment(Integer paymentID) {
        this.paymentID = paymentID;
    }

    public Integer getPaymentID() {
        return paymentID;
    }

    public void setPaymentID(Integer paymentID) {
        this.paymentID = paymentID;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }

    public String getHoldername() {
        return holdername;
    }

    public void setHoldername(String holdername) {
        this.holdername = holdername;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getBank() {
        return bank;
    }

    public void setBank(String bank) {
        this.bank = bank;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getIssueDate() {
        return issueDate;
    }

    public void setIssueDate(String issueDate) {
        this.issueDate = issueDate;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (paymentID != null ? paymentID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Payment)) {
            return false;
        }
        Payment other = (Payment) object;
        if ((this.paymentID == null && other.paymentID != null) || (this.paymentID != null && !this.paymentID.equals(other.paymentID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Payment[paymentID=" + paymentID + "]";
    }

}
